<!DOCTYPE html>
<html lang="zh-CN" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../assets/css/layui.css">
    <link rel="stylesheet" href="../assets/css/view.css"/>
    <link rel="icon" href="/favicon.ico">
    <title>管理后台</title>
</head>
<body class="layui-view-body">
    <div class="layui-content">
        <div class="layui-page-header">
            <div class="pagewrap">
                <span class="layui-breadcrumb">
                  <a href="">首页</a>
                  <a href="">用户</a>
                  <a><cite>个人资料</cite></a>
                </span>
                <h2 class="title">个人资料</h2>
            </div>
        </div>
        <form class="layui-row">
            <form id="editForm" class="layui-form model-form" method="post" action="/merchant/save2"
                  enctype="multipart/form-data">


                <div class="layui-form-item">
                    <label class="layui-form-label">用户名</label>
                    <div class="layui-input-inline">
                        <input type="text" name="username" value="xianxin" readonly class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">不可修改。一般用于后台登入名</div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">昵称</label>
                    <div class="layui-input-inline">
                        <input type="text" name="nickname" value="xx" lay-verify="nickname" autocomplete="off" placeholder="请输入昵称" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">性别</label>
                    <div class="layui-input-block">
                        <input type="radio" name="sex" value="男" title="男">
                        <input type="radio" name="sex" value="女" title="女" checked>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">头像</label>
                    <div class="layui-input-inline">
                        <input name="avatar" lay-verify="required" id="LAY_avatarSrc" placeholder="图片地址" value="http://cdn.layui.com/avatar/168.jpg" class="layui-input">
                    </div>
                    <div class="layui-input-inline layui-btn-container" style="width: auto;">
                        <button type="button" class="layui-btn layui-btn-primary" id="LAY_avatarUpload">
                            <i class="layui-icon">&#xe67c;</i>上传图片
                        </button>
                        <button class="layui-btn layui-btn-primary" layadmin-event="avartatPreview">查看图片</button >
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">手机</label>
                    <div class="layui-input-inline">
                        <input type="text" name="cellphone" value="" lay-verify="phone" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="setmyinfo">确认修改</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重新填写</button>
                    </div>
                </div>
            </form>


        </div>
    </div>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
     <script src="../assets/layui.all.js"></script>
    <script>
        ;
        layui.define(["form", "upload"], function(t) {
            var i = layui.$,
                e = layui.layer,
                n = layui.form,
                s = layui.upload;
            i("body");

            var r = i("#LAY_avatarSrc");
            s.render({
                url: "/file/upload/",
                elem: "#LAY_avatarUpload",
                done: function(t) {

                    0 == t.status ? r.val(t.url) : e.msg(t.msg, {
                        icon: 5
                    })
                    $("#editForm input[name=avatar]").val(t.obj);
                    console.log(t)
                }
            }), n.on("submit(setmyinfo)", function(t) {
                return e.msg(JSON.stringify(t.field)), !1
            }), t("set", {})
        });

        $.get("merchant/data", function (data) {
           console.log(data)
            // if (data.code == 200) {
            //     layer.msg(data.msg, {icon: 1});
            // } else {
            //     layer.msg(data.msg, {icon: 2});
            // }
        }, "JSON");

    </script>
</body>
</html>